<?php defined('IN_ADMIN') or exit('No permission resources.'); ?>
<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="utf-8">
    <title> <?php echo L('admin_site_title')?> </title>
    <meta name="description" content="">
    <meta name="author" content="">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <link rel="stylesheet"  href="<?php echo ADMIN_PATH?>css/bootstrap.min.css">
    <link rel="stylesheet"  href="<?php echo ADMIN_PATH?>css/font-awesome.min.css">
    <link rel="stylesheet"  href="<?php echo ADMIN_PATH?>css/smartadmin-production.css">
    <link rel="stylesheet"  href="<?php echo ADMIN_PATH?>css/smartadmin-skins.css">
    <link rel="stylesheet"  href="<?php echo ADMIN_PATH?>css/admin-style.css">
    <link href="<?php echo ADMIN_PATH?>css/dialog.css" rel="stylesheet" type="text/css" />
    <link rel="shortcut icon" href="<?php echo ADMIN_PATH?>img/favicon/favicon.ico" type="image/x-icon">
    <link rel="icon" href="<?php echo ADMIN_PATH?>img/favicon/favicon.ico" type="image/x-icon"> </head>
    <style type="text/css" media="screen">
        .pace .pace-activity {
        display: block;
        position: absolute;
        z-index: 2000;
        top: 50%;
        left: 50%;
        width: 40px;
        height: 40px;
        margin-top: 27px;
        margin-left: 90px;
        border: solid 2px transparent;
        border-top-color: #29d;
        border-left-color: #ff0;
        border-bottom-color: #29d;
        border-right-color: #ff0;
        border-radius: 20px;
        -webkit-animation: pace-spinner 400ms linear infinite;
        -moz-animation: pace-spinner 400ms linear infinite;
        -ms-animation: pace-spinner 400ms linear infinite;
        -o-animation: pace-spinner 400ms linear infinite;
        animation: pace-spinner 400ms linear infinite;

}
.bottom-nav{background-color: #474544;height: 38px; padding: 3px;position: absolute;bottom;left: 0px; width: 100%; bottom: 0px;}
    </style>
    <script type="text/javascript">
        var pc_hash = '<?php echo $_SESSION['pc_hash']?>';
        var role_id = '<?php echo $_SESSION['roleid']?>';
    </script>
<body>

    <header id="header">
        <div id="logo-group"> <span id="logo"> <img src="<?php echo ADMIN_PATH?>img/logo-blacknwhite.png" alt="SmartAdmin"> </span> <span id="activity" class="activity-dropdown"> <i class="fa fa-bell"></i> <b class="badge"> 0 </b> </span>
            <div class="ajax-dropdown">
                <div class="ajax-notifications custom-scroll">
                    
                    </div> 
            <span class="text-right"> <button onclick="startRequest()" type="button" data-loading-text="<i class='fa fa-refresh fa-spin'></i> Loading..." class="btn btn-xs btn-default pull-right"> <i class="fa fa-refresh"></i> </button> </span> </div>
        </div>      
        <div class="pull-right">
            <div id="hide-menu" class="btn-header pull-right"> <span> <a href="javascript:void(0);" title="Collapse Menu"><i class="fa fa-reorder"></i></a> </span> </div>
            <div id="logout" class="btn-header transparent pull-right"> <span> <a href="?m=admin&c=index&a=public_logout" title="<?php echo L('exit')?>"><i class="fa fa-sign-out"></i></a> </span> </div>
           
        </div>
        <div class="clearit"></div>
    </header>
    <aside id="left-panel">
        <div class="login-info"> <span>  <a href="javascript:void(0);" id="show-shortcut"> <img src="<?php echo ADMIN_PATH?>img/avatars/sunny.png" alt="me" class="online"> <span> <?php echo $admin_username?> </span> <i class="fa fa-angle-down"></i> </a>
            </span>
        </div>
        <nav >
            <ul id="leftMain"> </ul>
        </nav> <span class="minifyme"> <i class="fa fa-arrow-circle-left hit"></i> </span>
     </aside>


    <div id="main" role="main"  >
        <div class="collapse navbar-collapse navbar-inverse">
             <ul class="nav navbar-nav" id="top_menu">
                <?php
                $array = admin::admin_menu(0);
                foreach($array as $_value) {
                    if($_value['id']==10) {
                        echo '<li id="_M'.$_value['id'].'" class="active top_menu"><a href="javascript:_M('.$_value['id'].',\'?m='.$_value['m'].'&c='.$_value['c'].'&a='.$_value['a'].'\')" hidefocus="true" style="outline:none;">'.L($_value['name']).'</a></li>';
                        
                    } else {
                        echo '<li id="_M'.$_value['id'].'" class="top_menu"><a href="javascript:_M('.$_value['id'].',\'?m='.$_value['m'].'&c='.$_value['c'].'&a='.$_value['a'].'\')"  hidefocus="true" style="outline:none;">'.L($_value['name']).'</a></li>';
                    }       
                }
                ?>
            </ul>
        </div>
        <div id="ribbon"> 
             <span class="ribbon-button-alignment"> <span id="refresh" class="btn btn-ribbon" data-title="refresh" rel="tooltip" data-placement="bottom" data-original-title="刷新内容" data-html="true"><i class="fa fa-refresh"></i></span> </span>
                <ol class="breadcrumb">
                    <li> 首页 </li>
                    <li>个人信息</li>
                    <li></li>
                </ol>
                <div class="pull-right" style="margin-top:4px; margin-right:20px">
                    <a class='btn btn-default btn-sm' href="?m=admin&c=index&a=update_price&pc_hash=<?php echo $_SESSION['pc_hash'];?>" target="right"><span>更新产品价钱</span></a> &nbsp;
                    <a class='btn btn-default btn-sm' href="?m=content&c=create_html&a=public_index&pc_hash=<?php echo $_SESSION['pc_hash'];?>" target="right"><span><?php echo L('create_index')?></span></a> &nbsp;
                    <a class='btn btn-default btn-sm' href="?m=admin&c=cache_all&a=init&pc_hash=<?php echo $_SESSION['pc_hash'];?>" target="right"><span><?php echo L('update_backup')?></span></a> &nbsp;
                    <a class='btn btn-default btn-sm' href="javascript:art.dialog({id:'map',iframe:'?m=admin&c=index&a=public_map', title:'<?php echo L('background_map')?>', width:'700', height:'500', lock:true});void(0);"><span><?php echo L('background_map')?></span></a> 
                    <!-- <?php echo runhook('admin_top_left_menu')?> -->
                </div>
            </div>
        <div class="main-content">
      
             <div class="center_frame-wapper" id="display_center_id"  style="display: none;">
                    <iframe name="center_frame" id="center_frame" src="" frameborder="false" scrolling="auto" style="border:none" width="100%" height="auto" allowtransparency="true"></iframe>
             </div>   
             <div class="right_frame-wapper" id="right_frame-wapper">
      
                <iframe name="right" id="rightMain" src="?m=admin&c=index&a=public_main" frameborder="false" scrolling="auto" style="border:none;vertical-align: bottom;" width="100%" height="auto" allowtransparency="true"></iframe>
            </div>
        </div>
        <div class="bottom-nav">
            <span id="paneladd"></span>
            <span id="panellist">
             <?php foreach($adminpanel as $v) {?>
                <div class="btn-group">
                    <a class="btn btn-default" onclick="paneladdclass(<?php echo $v['menuid']?>,this);"target="right" href="<?php echo $v['url'].'menuid='.$v['menuid'].'&pc_hash='.$_SESSION['pc_hash'];?>"><?php echo L($v['name'])?></a>
                    <button class="btn btn-default dropdown-toggle" onclick="delete_panel(<?php echo $v['menuid']?>, this)">
                       <i class="fa fa-times"></i>
                    </button>
                </div>
            <?php }?>   
            </span>
            <input type="hidden" id="menuid" value="">
            <input type="hidden" id="bigid" value="" />
        </div>
    </div>
    <audio src="" id="audio"></audio>
    <script data-pace-options='{ "restartOnRequestAfter": true }' src="<?php echo ADMIN_PATH?>js/plugin/pace/pace.min.js"></script>
        <script type="text/javascript">
        paceOptions = {
              elements: {
                selectors: ['#audio']
              }
            }
    </script>

    <script src="<?php echo ADMIN_PATH?>js/libs/jquery-2.0.2.min.js"></script>
    <script src="<?php echo ADMIN_PATH?>js/libs/jquery-ui-1.10.3.min.js"></script>
    <script src="<?php echo ADMIN_PATH?>js/bootstrap/bootstrap.min.js"></script>
    <script src="<?php echo ADMIN_PATH?>js/notification/SmartNotification.min.js"></script>
    <script src="<?php echo ADMIN_PATH?>js/smartwidgets/jarvis.widget.min.js"></script>
    <script src="<?php echo ADMIN_PATH?>js/plugin/msie-fix/jquery.mb.browser.min.js"></script>
    <script src="<?php echo ADMIN_PATH?>js/plugin/fastclick/fastclick.js"></script>
    <script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>dialog.js"></script>
    <script src="<?php echo ADMIN_PATH?>js/app.js"></script>
    <!-- new admin js-->
<script type="text/javascript"> 
    $(document).ready(function() {
        $("#leftMain").load("?m=admin&c=index&a=public_menu_left&menuid=10",function(){
            // wSize();
            windowW();
            $('nav ul').jarvismenu({
                    accordion : true,
                    speed : $.menu_speed,
                    closedSign : '<em class="fa fa-expand-o"></em>',
                    openedSign : '<em class="fa fa-collapse-o"></em>'
                });
        });

    });
if(!Array.prototype.map)
Array.prototype.map = function(fn,scope) {
  var result = [],ri = 0;
  for (var i = 0,n = this.length; i < n; i++){
	if(i in this){
	  result[ri++]  = fn.call(scope ,this[i],i,this);
	}
  }
return result;
};

var getWindowSize = function(){
return ["Height","Width"].map(function(name){
  return window["inner"+name] ||
	document.compatMode === "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ]
});
}
window.onload = function (){
	if(!+"\v1" && !document.querySelector) { // for IE6 IE7
	  document.body.onresize = resize;
	} else { 
	  window.onresize = resize;
	}
	function resize() {
		// wSize();
		return false;
	}
}
function wSize(){
	//这是一字符串
        var str=getWindowSize();
        var strs= new Array(); //定义一数组
        strs=str.toString().split(","); //字符分割
        var Body =$(window),Left = $('#left-panel');
        var _heights = Body.height();
        var heights = _heights-177; 
        $('#rightMain').height(heights);  

         $('#display_center_id').height(heights);  
        //iframe.height = strs[0]-46;
        if(strs[1]<980){
            $('.header').css('width',980+'px');
            $('#content').css('width',980+'px');
            Body.attr('scroll','');
            Body.removeClass('objbody');
        }else{
            $('.header').css('width','auto');
            $('#content').css('width','auto');
            Body.attr('scroll','no');
            Body.addClass('objbody');
        }
        
        var openClose = $("#rightMain").height()+39;
        $('#center_frame').height(openClose+9);
        $("#openClose").height(openClose+30);   
        $("#Scroll").height(openClose-20);
        windowW();
    }
   
    function windowW(){
    if($('#Scroll').height()<$("#leftMain").height()){
        $(".scroll").show();
    }else{
        $(".scroll").hide();
        }
    }
    windowW();
    function _M(menuid,targetUrl,subMenuId) {
        $("#menuid").val(menuid);
        $("#bigid").val(menuid);
        $('.pace-activity').show()
         $("#paneladd").html('<a class="btn btn-labeled btn-warning" href="javascript:add_panel();"> <span class="btn-label"><i class="fa fa-plus-square"></i></span> 添加</a>');
        if(menuid!=8) {
            $("#leftMain").load("?m=admin&c=index&a=public_menu_left&menuid="+menuid, {limit: 25}, function(){
               // wSize()
               windowW();
               $('nav ul').jarvismenu({
                    accordion : true,
                    speed : $.menu_speed,
                    closedSign : '<em class="fa fa-expand-o"></em>',
                    openedSign : '<em class="fa fa-collapse-o"></em>'
                });
                if (typeof(subMenuId) !='undefined'){
                    $('#_MP'+subMenuId).addClass('active')
                    $('#_MP'+subMenuId).closest('ul').parent().find('a').trigger('click')
                }
             });
        } else {
            $("#leftMain").load("?m=admin&c=phpsso&a=public_menu_left&menuid="+menuid, {limit: 25}, function(){
                // wSize()
               windowW();
               $('nav ul').jarvismenu({
                    accordion : true,
                    speed : $.menu_speed,
                    closedSign : '<em class="fa fa-expand-o"></em>',
                    openedSign : '<em class="fa fa-collapse-o"></em>'
                });
             });
        }
        //$("#rightMain").attr('src', targetUrl);
        $('.top_menu').removeClass("active");
        $('#_M'+menuid).addClass("active");
        $.get("?m=admin&c=index&a=public_current_pos&menuid="+menuid, function(data){
            $("#current_pos").html(data);
        });
        //当点击顶部菜单后，隐藏中间的框架
        $('#display_center_id').css('display','none');
        $('.right_frame-wapper').css('left','0')
        //显示左侧菜单，当点击顶部时，展开左侧
        $(".left_menu").removeClass("left_menu_on");
        $("#openClose").removeClass("close");
        $("html").removeClass("on");
        $("#openClose").data('clicknum', 0);
        $("#current_pos").data('clicknum', 1);
    }
    function _MP(menuid,targetUrl,node) {
       $("#menuid").val(menuid);
         $('.pace-activity').hide()
         if($(node).closest('.bigBox').length === 1){
            $(node).closest('.bigBox').find('#botClose1').trigger('click')
         }
        $("#paneladd").html('<a class="btn btn-labeled btn-warning" href="javascript:add_panel();"> <span class="btn-label"><i class="fa fa-plus-square"></i></span> 添加</a>');
        $("#rightMain").contents().find('body').html('<div class="pace  pace-active"><div class="pace-progress" data-progress-text="100%" data-progress="99" style="width: 100%;"> <div class="pace-progress-inner"></div></div><div class="pace-activity-2"></div></div>')
        $("#rightMain").attr('src', targetUrl+'&menuid='+menuid+'&pc_hash='+pc_hash);
        if (typeof(node) =='undefined'){
            $('.breadcrumb li').eq(2).text($('#_MP'+menuid).text())
            $('.breadcrumb li').eq(1).text($('#_MP'+menuid).closest('.open').find('.menu-item-parent').text())
        }else{
           $('.breadcrumb li').eq(2).text('所有订单')
           $('.breadcrumb li').eq(1).text($(node).closest('tr').find('td').eq(0).text()) 
           $('.ajax-dropdown').hide()
        }
        $('.sub_menu').removeClass("active fb blue");
        $('#_MP'+menuid).addClass("active fb blue");
        $.get("?m=admin&c=index&a=public_current_pos&menuid="+menuid, function(data){
            $("#current_pos").html(data+'<span id="current_pos_attr"></span>');
        });
        $("#current_pos").data('clicknum', 1);
    }
    function add_panel() {
    var menuid = $("#menuid").val();
        $.ajax({
            type: "POST",
            url: "?m=admin&c=index&a=public_ajax_add_panel",
            data: "menuid=" + menuid,
            success: function(data){
                if(data) {
                    $("#panellist").html(data);
                }
            }
        });
    }
    function delete_panel(menuid, id) {
        $.ajax({
            type: "POST",
            url: "?m=admin&c=index&a=public_ajax_delete_panel",
            data: "menuid=" + menuid,
            success: function(data){
                $("#panellist").html(data);
            }
        });
    }

    function paneladdclass(id,node) {
        var _bigId = $('#bigid').val()
        $('#_M'+_bigId).find('a').trigger('click')
        $('#_MP'+id).closest('ul').parent().find('li').removeClass('active')
         $('#_MP'+id).addClass('active')
          $('.breadcrumb li').eq(1).text($(node).text())
          $('.breadcrumb li').eq(2).text('')
        
    }
    </script>


</body>
</html>